package com.wellink.android_demo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class Demo2Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.demo2_layout);

        Button btn6 = findViewById(R.id.btn6);
        btn6.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                Toast.makeText(Demo2Activity.this,"Activity收到onTouch事件",Toast.LENGTH_LONG).show();
                return false;
            }
        });
    }

    @Override
    public boolean onTouchEvent(MotionEvent event){
        super.onTouchEvent(event);
        Toast.makeText(Demo2Activity.this,"Activity 回调了onTouchEvent事件",Toast.LENGTH_LONG).show();
        return false;
    }
}
